package com.stars.easyms.logging.constant;

import com.stars.easyms.logging.ansi.EasyMsAnsiEnum;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>className: EasyMsLoggingConstants</p>
 * <p>description: EasyMsLogging常量类</p>
 *
 * @author guoguifang
 * @version 1.7.0
 * @date 2020/11/16 6:14 下午
 */
public final class EasyMsLoggingConstants {

    public static final String MODULE_NAME = "logging";

    public static final String EASY_MS_PLUME_LOG_APPENDER_NAME = "easyMsPlumeLogAppender";

    public static final String PLUME_LOG_REDIS_APPENDER_NAME = "plumeLogRedisAppender";

    public static final String PLUME_LOG_KAFKA_APPENDER_NAME = "plumeLogKafkaAppender";

    public static final String ELEMENTS_NAME_APPENDERS = "Appenders";

    public static final String ELEMENTS_NAME_ROOT = "root";

    public static final String PLUME_LOG_METHOD_ENTRY_POSITION = "<";

    public static final String PLUME_LOG_METHOD_EXIT_POSITION = ">";

    public static final String FILE_PROTOCOL = "file";

    public static final Map<String, String> DEFAULT_LEVEL_COLOR_MAP;

    static {
        Map<String, String> localLevelColorMap = new HashMap<>(8);
        localLevelColorMap.put("TRACE", "7a7a7a, bg_2b2b2b");
        localLevelColorMap.put("DEBUG", "7a7a7a, bg_2b2b2b");
        localLevelColorMap.put("INFO", "92c584, bg_2b2b2b");
        localLevelColorMap.put("WARN", "e5e431, bg_2b2b2b");
        localLevelColorMap.put("ERROR", "fc5759, bg_2b2b2b");
        localLevelColorMap.put("FATAL", "fc5759, bg_2b2b2b");
        DEFAULT_LEVEL_COLOR_MAP = Collections.unmodifiableMap(localLevelColorMap);
    }

    public static final String ENCODE_JOIN = ";";

    public static final String ENCODE_START = "\033[";

    public static final String ENCODE_END = "m";

    public static final String RESET = ENCODE_START + EasyMsAnsiEnum.NORMAL.getCode()
            + ENCODE_JOIN + EasyMsAnsiEnum.DEFAULT.getCode() + ENCODE_END;

    private EasyMsLoggingConstants() {
    }
}
